//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS SSMQuickSetup service.
///
/// Quick Setup helps you quickly configure frequently used services and features with recommended best practices. Quick Setup simplifies setting up services, including Systems Manager, by automating common or recommended tasks.
public struct SSMQuickSetup: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the SSMQuickSetup client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "SSMQuickSetup",
            serviceIdentifier: "ssm-quicksetup",
            serviceProtocol: .restjson,
            apiVersion: "2018-05-10",
            endpoint: endpoint,
            variantEndpoints: Self.variantEndpoints,
            errorType: SSMQuickSetupErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }




    /// FIPS and dualstack endpoints
    static var variantEndpoints: [EndpointVariantType: AWSServiceConfig.EndpointVariant] {[
        [.fips]: .init(endpoints: [
            "ca-central-1": "ssm-quicksetup-fips.ca-central-1.amazonaws.com",
            "us-east-1": "ssm-quicksetup-fips.us-east-1.amazonaws.com",
            "us-east-2": "ssm-quicksetup-fips.us-east-2.amazonaws.com",
            "us-west-1": "ssm-quicksetup-fips.us-west-1.amazonaws.com",
            "us-west-2": "ssm-quicksetup-fips.us-west-2.amazonaws.com"
        ])
    ]}

    // MARK: API Calls

    /// Creates a Quick Setup configuration manager resource. This object is a collection of desired state configurations for multiple configuration definitions and summaries describing the deployments of those definitions.
    @Sendable
    @inlinable
    public func createConfigurationManager(_ input: CreateConfigurationManagerInput, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateConfigurationManagerOutput {
        try await self.client.execute(
            operation: "CreateConfigurationManager", 
            path: "/configurationManager", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a Quick Setup configuration manager resource. This object is a collection of desired state configurations for multiple configuration definitions and summaries describing the deployments of those definitions.
    ///
    /// Parameters:
    ///   - configurationDefinitions: The definition of the Quick Setup configuration that the configuration manager deploys.
    ///   - description: A description of the configuration manager.
    ///   - name: A name for the configuration manager.
    ///   - tags: Key-value pairs of metadata to assign to the configuration manager.
    ///   - logger: Logger use during operation
    @inlinable
    public func createConfigurationManager(
        configurationDefinitions: [ConfigurationDefinitionInput],
        description: String? = nil,
        name: String? = nil,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateConfigurationManagerOutput {
        let input = CreateConfigurationManagerInput(
            configurationDefinitions: configurationDefinitions, 
            description: description, 
            name: name, 
            tags: tags
        )
        return try await self.createConfigurationManager(input, logger: logger)
    }

    /// Deletes a configuration manager.
    @Sendable
    @inlinable
    public func deleteConfigurationManager(_ input: DeleteConfigurationManagerInput, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "DeleteConfigurationManager", 
            path: "/configurationManager/{ManagerArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes a configuration manager.
    ///
    /// Parameters:
    ///   - managerArn: The ID of the configuration manager.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteConfigurationManager(
        managerArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = DeleteConfigurationManagerInput(
            managerArn: managerArn
        )
        return try await self.deleteConfigurationManager(input, logger: logger)
    }

    /// Returns details about the specified configuration.
    @Sendable
    @inlinable
    public func getConfiguration(_ input: GetConfigurationInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetConfigurationOutput {
        try await self.client.execute(
            operation: "GetConfiguration", 
            path: "/getConfiguration/{ConfigurationId}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns details about the specified configuration.
    ///
    /// Parameters:
    ///   - configurationId: A service generated identifier for the configuration.
    ///   - logger: Logger use during operation
    @inlinable
    public func getConfiguration(
        configurationId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetConfigurationOutput {
        let input = GetConfigurationInput(
            configurationId: configurationId
        )
        return try await self.getConfiguration(input, logger: logger)
    }

    /// Returns a configuration manager.
    @Sendable
    @inlinable
    public func getConfigurationManager(_ input: GetConfigurationManagerInput, logger: Logger = AWSClient.loggingDisabled) async throws -> GetConfigurationManagerOutput {
        try await self.client.execute(
            operation: "GetConfigurationManager", 
            path: "/configurationManager/{ManagerArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns a configuration manager.
    ///
    /// Parameters:
    ///   - managerArn: The ARN of the configuration manager.
    ///   - logger: Logger use during operation
    @inlinable
    public func getConfigurationManager(
        managerArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetConfigurationManagerOutput {
        let input = GetConfigurationManagerInput(
            managerArn: managerArn
        )
        return try await self.getConfigurationManager(input, logger: logger)
    }

    /// Returns settings configured for Quick Setup in the requesting Amazon Web Services account and Amazon Web Services Region.
    @Sendable
    @inlinable
    public func getServiceSettings(logger: Logger = AWSClient.loggingDisabled) async throws -> GetServiceSettingsOutput {
        try await self.client.execute(
            operation: "GetServiceSettings", 
            path: "/serviceSettings", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            logger: logger
        )
    }

    /// Returns Quick Setup configuration managers.
    @Sendable
    @inlinable
    public func listConfigurationManagers(_ input: ListConfigurationManagersInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListConfigurationManagersOutput {
        try await self.client.execute(
            operation: "ListConfigurationManagers", 
            path: "/listConfigurationManagers", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns Quick Setup configuration managers.
    ///
    /// Parameters:
    ///   - filters: Filters the results returned by the request.
    ///   - maxItems: Specifies the maximum number of configuration managers that are returned by the request.
    ///   - startingToken: The token to use when requesting a specific set of items from a list.
    ///   - logger: Logger use during operation
    @inlinable
    public func listConfigurationManagers(
        filters: [Filter]? = nil,
        maxItems: Int? = nil,
        startingToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListConfigurationManagersOutput {
        let input = ListConfigurationManagersInput(
            filters: filters, 
            maxItems: maxItems, 
            startingToken: startingToken
        )
        return try await self.listConfigurationManagers(input, logger: logger)
    }

    /// Returns configurations deployed by Quick Setup in the requesting Amazon Web Services account and Amazon Web Services Region.
    @Sendable
    @inlinable
    public func listConfigurations(_ input: ListConfigurationsInput, logger: Logger = AWSClient.loggingDisabled) async throws -> ListConfigurationsOutput {
        try await self.client.execute(
            operation: "ListConfigurations", 
            path: "/listConfigurations", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns configurations deployed by Quick Setup in the requesting Amazon Web Services account and Amazon Web Services Region.
    ///
    /// Parameters:
    ///   - configurationDefinitionId: The ID of the configuration definition.
    ///   - filters: Filters the results returned by the request.
    ///   - managerArn: The ARN of the configuration manager.
    ///   - maxItems: Specifies the maximum number of configurations that are returned by the request.
    ///   - startingToken: The token to use when requesting a specific set of items from a list.
    ///   - logger: Logger use during operation
    @inlinable
    public func listConfigurations(
        configurationDefinitionId: String? = nil,
        filters: [Filter]? = nil,
        managerArn: String? = nil,
        maxItems: Int? = nil,
        startingToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListConfigurationsOutput {
        let input = ListConfigurationsInput(
            configurationDefinitionId: configurationDefinitionId, 
            filters: filters, 
            managerArn: managerArn, 
            maxItems: maxItems, 
            startingToken: startingToken
        )
        return try await self.listConfigurations(input, logger: logger)
    }

    /// Returns the available Quick Setup types.
    @Sendable
    @inlinable
    public func listQuickSetupTypes(logger: Logger = AWSClient.loggingDisabled) async throws -> ListQuickSetupTypesOutput {
        try await self.client.execute(
            operation: "ListQuickSetupTypes", 
            path: "/listQuickSetupTypes", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            logger: logger
        )
    }

    /// Returns tags assigned to the resource.
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Returns tags assigned to the resource.
    ///
    /// Parameters:
    ///   - resourceArn: The ARN of the resource the tag is assigned to.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceArn: resourceArn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Assigns key-value pairs of metadata to Amazon Web Services resources.
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceInput, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Assigns key-value pairs of metadata to Amazon Web Services resources.
    ///
    /// Parameters:
    ///   - resourceArn: The ARN of the resource to tag.
    ///   - tags: Key-value pairs of metadata to assign to the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceArn: String,
        tags: [String: String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = TagResourceInput(
            resourceArn: resourceArn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Removes tags from the specified resource.
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceInput, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/tags/{ResourceArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Removes tags from the specified resource.
    ///
    /// Parameters:
    ///   - resourceArn: The ARN of the resource to remove tags from.
    ///   - tagKeys: The keys of the tags to remove from the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceArn: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = UntagResourceInput(
            resourceArn: resourceArn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }

    /// Updates a Quick Setup configuration definition.
    @Sendable
    @inlinable
    public func updateConfigurationDefinition(_ input: UpdateConfigurationDefinitionInput, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "UpdateConfigurationDefinition", 
            path: "/configurationDefinition/{ManagerArn}/{Id}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates a Quick Setup configuration definition.
    ///
    /// Parameters:
    ///   - id: The ID of the configuration definition you want to update.
    ///   - localDeploymentAdministrationRoleArn: The ARN of the IAM role used to administrate local configuration deployments.
    ///   - localDeploymentExecutionRoleName: The name of the IAM role used to deploy local configurations.
    ///   - managerArn: The ARN of the configuration manager associated with the definition to update.
    ///   - parameters: The parameters for the configuration definition type.
    ///   - typeVersion: The version of the Quick Setup type to use.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateConfigurationDefinition(
        id: String,
        localDeploymentAdministrationRoleArn: String? = nil,
        localDeploymentExecutionRoleName: String? = nil,
        managerArn: String,
        parameters: [String: String]? = nil,
        typeVersion: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = UpdateConfigurationDefinitionInput(
            id: id, 
            localDeploymentAdministrationRoleArn: localDeploymentAdministrationRoleArn, 
            localDeploymentExecutionRoleName: localDeploymentExecutionRoleName, 
            managerArn: managerArn, 
            parameters: parameters, 
            typeVersion: typeVersion
        )
        return try await self.updateConfigurationDefinition(input, logger: logger)
    }

    /// Updates a Quick Setup configuration manager.
    @Sendable
    @inlinable
    public func updateConfigurationManager(_ input: UpdateConfigurationManagerInput, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "UpdateConfigurationManager", 
            path: "/configurationManager/{ManagerArn}", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates a Quick Setup configuration manager.
    ///
    /// Parameters:
    ///   - description: A description of the configuration manager.
    ///   - managerArn: The ARN of the configuration manager.
    ///   - name: A name for the configuration manager.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateConfigurationManager(
        description: String? = nil,
        managerArn: String,
        name: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = UpdateConfigurationManagerInput(
            description: description, 
            managerArn: managerArn, 
            name: name
        )
        return try await self.updateConfigurationManager(input, logger: logger)
    }

    /// Updates settings configured for Quick Setup.
    @Sendable
    @inlinable
    public func updateServiceSettings(_ input: UpdateServiceSettingsInput, logger: Logger = AWSClient.loggingDisabled) async throws {
        try await self.client.execute(
            operation: "UpdateServiceSettings", 
            path: "/serviceSettings", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates settings configured for Quick Setup.
    ///
    /// Parameters:
    ///   - explorerEnablingRoleArn: The IAM role used to enable Explorer.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateServiceSettings(
        explorerEnablingRoleArn: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws {
        let input = UpdateServiceSettingsInput(
            explorerEnablingRoleArn: explorerEnablingRoleArn
        )
        return try await self.updateServiceSettings(input, logger: logger)
    }
}

extension SSMQuickSetup {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: SSMQuickSetup, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension SSMQuickSetup {
    /// Return PaginatorSequence for operation ``listConfigurationManagers(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listConfigurationManagersPaginator(
        _ input: ListConfigurationManagersInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListConfigurationManagersInput, ListConfigurationManagersOutput> {
        return .init(
            input: input,
            command: self.listConfigurationManagers,
            inputKey: \ListConfigurationManagersInput.startingToken,
            outputKey: \ListConfigurationManagersOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listConfigurationManagers(_:logger:)``.
    ///
    /// - Parameters:
    ///   - filters: Filters the results returned by the request.
    ///   - maxItems: Specifies the maximum number of configuration managers that are returned by the request.
    ///   - logger: Logger used for logging
    @inlinable
    public func listConfigurationManagersPaginator(
        filters: [Filter]? = nil,
        maxItems: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListConfigurationManagersInput, ListConfigurationManagersOutput> {
        let input = ListConfigurationManagersInput(
            filters: filters, 
            maxItems: maxItems
        )
        return self.listConfigurationManagersPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listConfigurations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listConfigurationsPaginator(
        _ input: ListConfigurationsInput,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListConfigurationsInput, ListConfigurationsOutput> {
        return .init(
            input: input,
            command: self.listConfigurations,
            inputKey: \ListConfigurationsInput.startingToken,
            outputKey: \ListConfigurationsOutput.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listConfigurations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - configurationDefinitionId: The ID of the configuration definition.
    ///   - filters: Filters the results returned by the request.
    ///   - managerArn: The ARN of the configuration manager.
    ///   - maxItems: Specifies the maximum number of configurations that are returned by the request.
    ///   - logger: Logger used for logging
    @inlinable
    public func listConfigurationsPaginator(
        configurationDefinitionId: String? = nil,
        filters: [Filter]? = nil,
        managerArn: String? = nil,
        maxItems: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListConfigurationsInput, ListConfigurationsOutput> {
        let input = ListConfigurationsInput(
            configurationDefinitionId: configurationDefinitionId, 
            filters: filters, 
            managerArn: managerArn, 
            maxItems: maxItems
        )
        return self.listConfigurationsPaginator(input, logger: logger)
    }
}

extension SSMQuickSetup.ListConfigurationManagersInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> SSMQuickSetup.ListConfigurationManagersInput {
        return .init(
            filters: self.filters,
            maxItems: self.maxItems,
            startingToken: token
        )
    }
}

extension SSMQuickSetup.ListConfigurationsInput: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> SSMQuickSetup.ListConfigurationsInput {
        return .init(
            configurationDefinitionId: self.configurationDefinitionId,
            filters: self.filters,
            managerArn: self.managerArn,
            maxItems: self.maxItems,
            startingToken: token
        )
    }
}
